/**
 * 包含 dom 相关的各类操作
 */
class DomUtils {

    /**
     * 递归获取组件的 ZIndex
     *
     * @param element {HTMLElement}
     * @returns {number}
     */
    static getZIndex(element) {
        let index = getComputedStyle(element).zIndex;
        if (index !== 'auto') {
            return index;
        }

        let p = element.parentNode;
        while(true){
            if(p === undefined || p === null){
                return -1;
            } else {
                index = getComputedStyle(element).zIndex;
                if(index !== 'auto'){
                    return index;
                }
            }
            p = p.parentNode;
        }
    }
}